<title>Number of Requests to the Application</title>

<% unless @datasource.default? %>
  <%#= link_to raw("&larr; Back"), rails_performance_path, class: "back_link" %>
<% end %>

<div class="columns">
  <div class="column">
    <div class="card">
      <div class="card-content">
        <h2 class="subtitle is-size-1"><%= ms @percentile_report_data[:p50] %></h2>
        <p class="content is-size-4">p50</p>
      </div>
    </div>
  </div>

  <div class="column">
    <div class="card">
      <div class="card-content">
        <h2 class="subtitle is-size-1"><%= ms @percentile_report_data[:p95] %></h2>
        <p class="content is-size-4">p95</p>
      </div>
    </div>
  </div>

  <div class="column">
    <div class="card">
      <div class="card-content">
        <h2 class="subtitle is-size-1"><%= ms @percentile_report_data[:p99] %></h2>
        <p class="content is-size-4">p99</p>
      </div>
    </div>
  </div>
</div>

<div class="card">
  <div class="card-content">
    <h2 class="subtitle">Throughput Report</h2>
    <div id="throughput_report_chart" class="chart"></div>
    <p class="content is-small">All requests (site visitors, search engines, bots, etc)</p>
  </div>
</div>

<br/>

<div class="card">
  <div class="card-content">
    <h2 class="subtitle">Average Response Time Report</h2>
    <div id="response_time_report_chart" class="chart"></div>
    <p class="content is-small">All requests (site visitors, search engines, bots, etc)</p>
  </div>
</div>

<% content_for :on_load do %>
  <script>
    var data1 = <%= raw @throughput_report_data.to_json %>;
    showTIRChart('throughput_report_chart', data1, ' rpm', 'RPM');

    var data2 = <%= raw @response_time_report_data.to_json %>;
    showRTChart('response_time_report_chart', data2);
  </script>
<% end %>
